package com.example.myapplication;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class BlankFragment3 extends Fragment {
    RecyclerView recyclerView;

    Context context;

    Adapter3 adapter;
    @SuppressLint("MissingInflatedId")
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view=inflater.inflate(R.layout.activity_adapter3, container, false);

        recyclerView= view.findViewById(R.id.recycler4);

        List<Map<String,Object>> list=new ArrayList<>();

        String[] itemName={"朋友圈","视频号","直播","扫一扫","听一听","小程序"};

        int[] image={R.drawable.circle,R.drawable.circle3,R.drawable.circle4,R.drawable.circle5,R.drawable.circle1,R.drawable.circle2};

        for(int i=0;i<image.length;i++){
            Map<String,Object> map=new HashMap<>();
            map.put("image",image[i]);
            map.put("item",itemName[i]);
            map.put("arrow",R.drawable.arrow);
            list.add(map);
        }

        context=getContext();

        adapter=new Adapter3(getContext(),list);

        LinearLayoutManager manager=new LinearLayoutManager(getContext());

        manager.setOrientation(RecyclerView.VERTICAL);

        recyclerView.setAdapter(adapter);

        recyclerView.setLayoutManager(manager);
        return view;
    }
}